package com.swjd.controller;

import com.swjd.dao.TLCDao;
import com.swjd.pojo.TLogisticsCompany;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author 刘涛
 * @create 2021/10/13 23:12
 */
@Controller
public class TLCController {
    @Autowired
    private TLCDao tlcDao;

    @RequestMapping("/Main_client01")
    public String MainOne(Model model) {
        List<TLogisticsCompany> tLogisticsCompanies = tlcDao.selectList(null);
        model.addAttribute("TLC", tLogisticsCompanies);
        return "Main_client01";
    }

    @RequestMapping("/Main_client02")
    public String MainTwo() {
        return "Main_client02";
    }
    @RequestMapping("/add")
    public String add(String txt_Name6,String txt_Name,String txt_Name2,String txt_Name4,String txt_Name3,String txt_Name5,String txt_Code) {
        TLogisticsCompany tLogisticsCompany = new TLogisticsCompany();
        tLogisticsCompany.setCompanyId(txt_Name6);
        tLogisticsCompany.setCompanyName(txt_Name);
        tLogisticsCompany.setCompanyCity(txt_Name2);
        tLogisticsCompany.setCompanyPhone(txt_Name4);
        tLogisticsCompany.setCompanyFax(txt_Name3);
        tLogisticsCompany.setCompanyAdress(txt_Name5);
        tLogisticsCompany.setCompanyRemark(txt_Code);
        tlcDao.insert(tLogisticsCompany);
        return "redirect:/Main_client01";
    }
}
